#!/usr/bin/python
# encoding: utf-8
'''
@File    :   ghost_loop.py
@Time    :   2020/03/11 23:46:24
@Author  :   fangkaijin 
@Version :   1.0
@Contact :   fangkaijin@gmail.com
@License :   杭州移动互联
@Desc    :   None
'''

# 导入库包
import sys, os
import unicodedata

#循环

l = ['小黑', '小白', '小红']
for name in l:
    print(name)
else:
    print('循环异常')

sum = 0
for num in range(10):
    sum += num
print(sum)

#字典和set
d = {'key1': '小黑', 'key2': '小白', 'key3': '小花',  'key4': '小草'}
print(len(d))
print(d['key4'])
d['key1'] = 'aaron'
print(d)
print('key6' in d)

print(d.get('key7'))

d.pop('key3')
print(d)

for (index, value) in d.items():
    print(index + '---'+ value)
    #print(value)

#set
s = set(['key1', 'key2', 'key3'])
print(len(s))
print(s)
s.add(3)
print(s)

l = ['小黑', '小白', '小草', '小花']
ls = set(l)
print(len(ls))
print(ls)
ls.add('小红')
print(ls)
ls.remove('小黑')
print(ls)

for key in ls:
    print(key)


